package com.yonder.hashmaptest;

public class Test {
	static MyPeriodHashMap<String> a = new MyPeriodHashMap<String>();
	public static void main(String[] args) {
		testPut(0, 100000);
//		System.out.println(testGet(50000, 100000));
//		System.out.println(testGet(100000, 150000));
		testGet(50000, 100000);
		testGet(260000, 280000);
	}
	
	private static void testPut(int keyMin, int keyMax) {
		long t1 = System.currentTimeMillis();
		for (int i = keyMin; i < keyMax; i++) {
			a.put(i, "" + i);
		}
		long t2 = System.currentTimeMillis();
		System.out.println(t2 - t1);
	}
	
	private static int testGet(int keyMin, int keyMax) {
		int count = 0;
		long t1 = System.currentTimeMillis();
		for (int i = keyMin; i < keyMax; i++) {
			String str = a.get(i);
			if (str != null) {
				count += str.length();
			}
		}
		long t2 = System.currentTimeMillis();
		System.out.println(t2 - t1);
		return count;
	}
}
